package design_pattern.strategy.demo_sort;

import java.util.Comparator;

public class MemStrategy implements Comparator<Host> {

    @Override
    public int compare(Host o1, Host o2) {
	int memFrequency1 = o1.getMenFrequency();
	int memFrequency2 = o2.getMenFrequency();
	int memCapacity1 = o1.getMenCapacity();
	int memCapacity2 = o2.getMenCapacity();
	double wFrequency = (memFrequency1-memFrequency2)*0.2;
	double wCapacity = (memCapacity1-memCapacity2)*0.8;
	if((wFrequency+wCapacity) < 0){
	    return 1;
	}else if((wFrequency+wCapacity) > 0){
	    return -1;
	}
	return 0;
    }
    
}
